package com.ardf.controller;

import com.ardf.common.CodeEnum;
import com.ardf.common.ReturnResult;
import com.ardf.entity.Details;
import com.ardf.entity.dto.UnitMenuDto;
import com.ardf.service.IDetailsService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ShiYunHao
 * @since 2025-01-06
 */
@RestController
@RequestMapping("/ardf/details")
public class DetailsController {

    @Resource
    private IDetailsService detailsService;

    /**
     * author:容伟洪
     * time:2025-3-6
     * description：前端控制器，接收成绩id查询打卡详情
     */
    @GetMapping("/getDetailsByGId")
    public ResponseEntity<ReturnResult> searchDetailByGId(@RequestParam("gradeId") Long gradeId) {
        System.out.println(gradeId);
        List<Details> details = detailsService.selectByGId(gradeId);

        ReturnResult result=new ReturnResult(CodeEnum.SUCCESS);
        result.setData(details);
        return ResponseEntity.ok(result);
    }

}
